package com.example.smstest;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.telephony.SmsManager;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {
	
	String strPhoneNo = "0882231147";
	String strMessage = "Test";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		 Intent newIntent = new Intent(Intent.ACTION_VIEW);
	     newIntent.putExtra("address", strPhoneNo);  // Default Address to
	     newIntent.putExtra("sms_body",strMessage); // Default Message
	     newIntent.setType("vnd.android-dir/mms-sms");
	     SmsManager smsManager = SmsManager.getDefault();    
	     startActivity(newIntent);
	     smsManager.sendTextMessage(strPhoneNo, null, strMessage, null, null);
			Toast.makeText(getApplicationContext(), "SMS has been send.",
						Toast.LENGTH_LONG).show();
			
        
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
